import { GCellRenderer } from "../../../../../com/mui/controls/GCellRenderer";
import { BaseItem } from "../../common/BaseItem";
import { ObjCreate } from "../../common/ObjCreate";
import { SkillItem } from "../../skill/SkillItem";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { SkillComposeData } from "./SkillComposeData";
import { ItemData } from "../../../resource/info/ItemData";
import { Vector } from "../../../../../__AS3__/vec/Vector";
//class SkillComposeTipsRenderer
    
    export  class SkillComposeTipsRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            this._malterial = new Vector.<BaseItem>();
            this.initUI();
            return;
        }

        /* internal  */initUI(): void
        {
            var loc1=0;
            var loc2=null;
            this._skillName = ObjCreate.createGTextField("", 0, 0, 200, 30, this);
            this._skillTips = ObjCreate.createGTextField("", 85, 20, 200, 35, this);
            this._skill = new SkillItem();
            this._skill.setSize(32, 32);
            this._skillBg = ObjCreate.createBitmap(ImagesConst.PackItemBg, 0, 55, this);
            this._skill.x = 3;
            this._skill.y = this._skillBg.y + 3;
            addChild(this._skill);
            loc1 = 0;
            while (loc1 < 3) 
            {
                loc2 = new BaseItem();
                this._itemBg = GlobalClass.getBitmap(ImagesConst.PackItemBg);
                this._malterial.push(loc2);
                this._malterial[loc1].setSize(32, 32);
                this._malterial[loc1].isDragAble = false;
                this._itemBg.x = loc1 * 66 + 80;
                this._itemBg.y = 55;
                this._malterial[loc1].x = this._itemBg.x + 3;
                this._malterial[loc1].y = this._itemBg.y + 3;
                addChild(this._itemBg);
                addChild(this._malterial[loc1]);
                ++loc1;
            }
            ObjCreate.createBg(40, 102, 250, 1, this, ImagesConst.SplitLine);
            ObjCreate.createBitmap(ImagesConst.HeroBattleAdd, 122, 62, this);
            ObjCreate.createBitmap(ImagesConst.HeroBattleAdd, 188, 62, this);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            var loc1=new SkillComposeData();
            loc1.parseObj(arg1);
            var loc2=0;
            while (loc2 < this._malterial.length) 
            {
                this._malterial[loc2].itemData = new ItemData(int(loc1.formula.split("#")[loc2]));
                ++loc2;
            }
            this._skillName.htmlText = "<font color=\'#ffff00\' size=\'14\'>" + loc1.skillInfo.skillName + "</font>";
            this._skillTips.htmlText = loc1.skillInfo.tSkill.skillDescription;
            this._skillTips.wordWrap = true;
            this._skill.data = loc1.skillInfo;
            this._skill.toolTipData = loc1.skillInfo.getToolTipInfo();
            return;
        }

        /* internal */ /* var */_skillName: Object /* flash.text.TextField */;

        /* internal */ /* var */_skillTips: Object /* flash.text.TextField */;

        /* internal */ /* var */_malterial: Vector.<BaseItem>;

        /* internal */ /* var */_skill: SkillItem;

        /* internal */ /* var */_skillBg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_itemBg: Object /* flash.display.Bitmap */;
    }
